<template>
  <div id="body">
    <div id="pic">
      <input type="checkbox" :checked="state" :id="('radio'+id)" @change="change(id,$event)"/>
      <label :for="('radio'+id)"><img :src="pic" /></label>
    </div>
    <div id="text">
      <p>{{title}}</p>
      <div id="pic">
        <span>￥{{price}}</span>
        <!-- <BTN :count="count" :id="id"></BTN> -->
        <slot></slot>
      </div>
    </div>
  </div>
</template>

<script>
// import BTN from "@/components/but.vue"
export default {
  data(){
    return {
    }
  },
  methods:{
    change(id,e){
      var checked={
        'id':id,
        'checked':e.target.checked
      }
      this.$emit('changeChecked',checked)
    }
  },
  components:{
    // BTN
  },
  props:{
    id:{
      require:true,
      type:Number
    },
    title:{
      type:String
    },
    pic:{
      type:String
    },
    price:{
      require:true,
      type:Number
    },
    state:{
      type:Boolean,
      default:false
    },
    count:{
      type:Number,
      default:0
    }
  }
};
</script>

<style scoped lang="less">
* {
  padding: 0;
}
img {
  width: 80px;
  height: 80px;
}
label {
  padding: 0;
  font-size: 0;
}

#body {
  // border-top: 1px solid gray;
  border-bottom: 1px solid gray;
  height: 100px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#pic{
  display: flex;
  align-content: center;
}
#text{
  padding-left: 10px;
  height: 80px;
  justify-content:space-between;
  p{
    margin-top: 0;
  }
  span{ 
    color: red;
  }
  #pic{
    display: flex;
    justify-content: space-between;
  }

}
</style>